package com.example.tasktable.util;

import com.example.tasktable.entity.task_table;
import com.example.tasktable.mapper.task_table_mapper;
import javafx.scene.control.Alert;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class GetMatterDataUtil {
    public static List<task_table> GetData() {
        try {
            SqlSession sqlSession = SqlSessionUtil.GetSession();
            task_table_mapper mapper = sqlSession.getMapper(task_table_mapper.class);
            List<task_table> task_tables = mapper.ListMatterDate();
            sqlSession.close();
            return task_tables;
        } catch (Exception e) {
            Alert alert = new Alert(Alert.AlertType.ERROR);
            alert.setTitle("异常提示");
            alert.setHeaderText("警告！！！数据库错误！");
            alert.setContentText("数据错误！异常原因：" + e);
            alert.showAndWait();
            System.exit(0);
            return null;
        }
    }
}
